﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ThucThe;
using DieuKhien;

namespace GiaoDien
{
    public partial class QL_DiaDanh_Them : Form
    {
        DiaDanh_thucthe dd_tt = new DiaDanh_thucthe();
        DiaDanh_dieukhien dd_dk = new DiaDanh_dieukhien();
        
        public QL_DiaDanh_Them()
        {
            InitializeComponent();
        }

        private void btn_OK_Click(object sender, EventArgs e)
        {
            try
            {
                dd_tt.TenDiaDanh = txt_tenDiaDanh.Text.Trim();
                dd_tt.MoTa = txt_moTa.Text.Trim();
                dd_tt.DiaChi = txt_diaChi.Text.Trim();

                dd_dk.themDiaDanh(dd_tt);

                this.Close();
                QL frm_ql = new QL();
                frm_ql.Show();
            }catch(NullReferenceException)
            {
                MessageBox.Show("Nhập đầy đủ các trường", "Thêm địa danh");
            }
        }

    }
}
